﻿UpCleanPlantBiogeo                package:unknown                R Documentation

UpCleanPlantBiogeo processes data gathered from global biodiversity data repositories such as the Global Biodiversity Information Facility (GBIF) and speciesLink (spLink) for plant biogeographical studies.
It Updates plant taxon names, according to the accepted names on The Plant List's database, and Cleans species occurrence data (coordinates).

Description:

	UpCleanPlantBiogeo takes a dataframe containing plant species occurrence data, checks for species names synonymy and accepted names on The Plant List's database, generating an updated dataframe with the accepted names.
	Depending on the user's choice, the function also cleans geographic coordinates (i.e., removes records without geographic coordinates, and with value = 0) and plots them on a map for visual inspection, in order to readly spot potential outliers and/or records with erroneous geographic coordinates.

Usage:

	UpCleanPlantBiogeo(x, from = "spLink", cleanMap = TRUE)

Arguments:
	x				data.frame, downloaded either from GBIF or speciesLink (spLink).
	
	from			character (required). Specify from which repository the data (x) has been retrieved: from = "GBIF" or from = "spLink". Default = "spLink".
	
	cleanMap		logical. If TRUE, cleans geographic coordinates that are missing from each record (row) and plots a map for visual inspection of species occurrence points. If FALSE, does not perform any of the steps previously described.
		

Details:
	
	The input data.frame must contain columns named "family", "genus", "species", "specificEpithet", "subspecies", "lon", "longitude", "lat", "latitude",  it will depend on the data source. Data from the GBIF must have at least columns named: "family", "genus", "specificEpithet", "lon", "lat". Data from spLink must have at least columns named "family", "genus", "species", "subspecies", "longitude", "latitude".
    
	Input files must be downloaded either from speciesLink (http://www.splink.org.br/index?lang=pt) or GBIF (http://www.gbif.org/). The function will only work on GBIF data downloaded via gbif() function from dismo package.
	
	The mapping step is only going to work properly if geographic coordinates are in decimal degrees, which is the default geographic coordinate format provided by the GBIF and spLink. So make sure the input file contains the correct format of geographic coordinates.
	
	Before running UpCleanPlantBiogeo, make sure to install the following packages: taxize and maptools
	
Value:
	
	An output file will be saved on the working directory in csv format.
	
	The function returns a list containing (1) a dataframe with all the accepted names, and (2) a vector containing a very simple report with the number of records that have been removed from the original dataframe for being unidentified records and/or without geographic coordinates, depending on the arguments provided to the function.
	
	A map will be returned as a graphical device on the user's screen.

Warning:

	The function will stop and print an error message if the input file is not a data.frame.

	The function will only work on GBIF data downloaded via the gbif() function from dismo package.
	
	Geographic coordinates must be in decimal degrees, otherwise the mapping step will be compromised.

Author(s):

    Eric Yasuo Kataoka, erickataoka@usp.br

References:
	
	1. Global Biodiversity Information Facility - GBIF website (http://www.gbif.org)
	2. speciesLink website (http://splink.cria.org.br )

See Also:

    speciesgeocodeR, taxize, dismo and rgbif packages

Examples:
	
	# Remember: make sure you have installed taxize and maptools packages before running UpCleanPlantBiogeo
	
	### Example1, data downloaded from spLink, default arguments
	## Not run:
	sample.spLink = read.csv("sample_spLink.csv", header = TRUE, sep = ",", dec = ".", as.is=T)
	UpCleanPlantBiogeo(sample.spLink, from = "spLink")
	## End (Not run)
	
	### Example 2, data downloaded from spLink, from = "spLink" and cleanMap = FALSE
	## Not run:
	sample.spLink = read.csv("sample_spLink.csv", header = TRUE, sep = ",", dec = ".", as.is=T)
	UpCleanPlantBiogeo(sample.spLink, from = "spLink", cleanMap = FALSE)
	## End (Not run)
	
	### Example3, data downloaded from GBIF, default arguments
	## Not run:
	sample.GBIF = read.csv("sample_GBIF.csv", header = TRUE, sep = ",", dec = ".", as.is=T)
	UpCleanPlantBiogeo(sample.GBIF, from = "GBIF")
	## End (Not run)
	
	### Example4, data downloaded from GBIF, from = "spLink" and cleanMap = FALSE
	## Not run:
	sample.GBIF = read.csv("sample_GBIF.csv", header = TRUE, sep = ",", dec = ".", as.is=T)
	UpCleanPlantBiogeo(sample.GBIF, from = "GBIF", cleanMap = FALSE)
	## End (Not run)


